package com.tech.connect.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.request.RequestOptions;
import com.ksy.common.image.ImageLoader;
import com.tech.connect.R;
import com.tech.connect.api.UserInfo;

public class UserInfoActivity extends BaseActivity {
    private ImageView ivHead;
    private ImageView ivVip;
    private TextView tvName;
    private TextView tvDate;
    private TextView tvCharge;
    private ImageView ivCover;

    protected boolean isShowHeadBar() {
        return false;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_info);
        initView();
        loadData();
    }


    private void initView() {
        findViewById(R.id.ivBack).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });

        ivCover = findViewById(R.id.ivCover);
        ivHead = findViewById(R.id.ivHead);
        ivVip = findViewById(R.id.ivVip);
        tvName = findViewById(R.id.tvName);
        tvDate = findViewById(R.id.tvDate);
        tvCharge = findViewById(R.id.tvCharge);

        findViewById(R.id.tvFaBu).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jump2Activity(MyFaBuActivity.class);
            }
        });
        findViewById(R.id.tvFuWu).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jump2Activity(MyFuWuActivity.class);
            }
        });
        findViewById(R.id.tvLvXing).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jump2Activity(MyLvYouActivity.class);
            }
        });
        findViewById(R.id.tvWanJia).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jump2Activity(MyWanJiaActivity.class);
            }
        });
        findViewById(R.id.tvGuanZhu).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jump2Activity(MyGuanZhuActivity.class);
            }
        });

    }


    private void loadData() {
        UserInfo userInfo = UserInfo.getUserInfo();
        ImageLoader.getInstance().load(activity, userInfo.backgroundImage, ivCover, new RequestOptions().placeholder(R.drawable.icon_headbar).error(R.drawable.icon_headbar));
        ImageLoader.getInstance().loadHead(activity, userInfo.headImage, ivHead);
        tvName.setText(userInfo.nickName);
//        tvDate.setText(userInfo.v);

    }

}